#define MAX_SERVICE_NAME_LENGTH  27
#define MAX_AUDIO_PID            32
#define MAX_SUBTITLE_PID         8
typedef   struct   audio_stream_struct
{
   unsigned int  sAudPid: 13;
                   /*
                * (13) - PMT
                * Elementary Audio stream PID
                */
   unsigned int  bDual:     1;
   unsigned int  bDolbyAC3: 1;
   unsigned int  iNormalAudio: 2;  /*When bDual == 0 */
                    /* 00---sterio
                   11---left
                  10---right
                  11---Mix
                    */
   unsigned int  iDualAudio: 2;   /*When bDual == 1 */
                    /* 00---sterio
                   01---left
                  10---right
                  11---Mix
                     */
   unsigned int  iAudioLan : 8; /*The index of Audio Language */
   unsigned int  iVolumnStep : 5; /*for Volumn num*/
   unsigned int  iAudiotype : 8; /*for audio format_type*/
}AUDIO_STREAM_STRUCT;

typedef struct subtitle_stream_struct
{
   unsigned int  sSubPid     :13;  /*PID when subtitle type 1: teletex page 0:subtitle pid*/
   unsigned int  iAudioLan   :8;   /*The index of Audio Language */
   unsigned int  iSubtileType:8;   /*1 teletex sub 0 subitle*/
   unsigned int  iCompositionPageID:16;
   unsigned int  iAncillaryPageID:16;
   unsigned int  iSelect   :1;
   unsigned int  iSubSelected   :2; /*Current selected Sub PID*/
}SUBTITLE_STRUCT;

typedef   struct   program_info_table
{
   unsigned int  uiStartCode; /*0x5555*/
   unsigned char ucNameLen;
   unsigned char ucAudioPID;  /*Only save the available PID in Flash*/
   unsigned char ucSubPID;    /*Only save the available PID in Flash*/
   unsigned char ucFav;       /*FAV Mark*/

   short int      sVidPid;   /*13 bit valid*/
   short int     sPcrPid;   /*13 bit valid*/
   short int     sPmtPid;   /*13 bit valid*/
   short int     sPvtPid;   /*13 bit valid*/
   //WORD2SHORT     stProgNo;  /*Unique ID*/
   short int     stProgNo;  /*Unique ID*/
               /*
                * stProgNo . sLo16 - Program No (16) - PAT
                * stProgNo . sHi16 - Transponder No (16) - set by application
                */
   union
   {
      struct
      {
         unsigned int iAudPID: 6; /*Current Audio PID*/
         unsigned int iLock  : 1;
                                /* 0---Unlock
                              1---Lock
                                 */
         unsigned int iTV    : 1;
                                 /*0---TV
                              1---Radio
                               */
         unsigned int iSkip:   1; /*0--Normal
                              1--Skip
                             */

         unsigned int iCAType: 16;
                               /*0--- Free
                            1--- Viaccess
                           2--- Nagravision
                           3--- Irdeto
                           4--- Seca
                           5--- Skycript
                           6--- NDS
                           */
         unsigned int uiOneSeg:1;  //0: Full-Seg; 1: 1-Seg
         unsigned int iNetNo: 3; /*Bean 050822: which Network name in the TP:
                                0-3: Valide
                               4-7: Invalide
                                    */
         unsigned int uiVideoType:1; /*To Save the ECM index, when power off/on can save the ProvID*/
         unsigned int iTSID_ONID:1;
                               /*
                            0 --  transport stream ID and original network ID are not saved in flash, all are 0
                           1 -- transport stream ID and original network ID are saved in flash
                           */
         unsigned int iReserved:1; /*To Save the ECM index, when power off/on can save the ProvID*/
      }uiBit;
      unsigned int  uiStatus;
   }uiSet;
   unsigned short int  uiRapsDisplayNo;
   unsigned short int  uiRapsUniNo;
#if 1
   union
      {
         struct
         {
            unsigned short  bLcn:1;/*david wan add  sign have lcn or not   */
            unsigned short ucRecersed2:5; /*denny 02022010:remote_control_key_id in the ts_infomation_descriptor: */
            unsigned short iProgLCN:10;/*david wan add logical channel numbers   */
         }DVBT;
         struct
         {
            unsigned short uiOneSeg:1;  //0: Full-Seg; 1: 1-Seg
            unsigned short ucRecersed2:7;
            unsigned short ucRCKid:8; /*denny 02022010:remote_control_key_id in the ts_infomation_descriptor: */
         }ISDBT;
         unsigned short usSpecial;
      };
   unsigned int ucRapsGenre:5;
   unsigned int bISDBTProg:1;// 1:   isdtb prog     0:  s2 prog
   unsigned int uiResverdfor:26;
#endif

   /*The following are variable*/
   char acServiceName[ MAX_SERVICE_NAME_LENGTH + 1 ];
   AUDIO_STREAM_STRUCT astAudio[ MAX_AUDIO_PID ];
   SUBTITLE_STRUCT     astSubPid[ MAX_SUBTITLE_PID ];

   /* warning !! must keep the following 2 ID adjacent */
   unsigned short int  usTSID;   /* transport stream ID, 2009-04-12 add  */
   unsigned short int  usONID; /* original network ID, 2009-04-12 add */
}PROGRAM_INFO_STRUCT /* sizeof() = 244*/;
